package com.mzy.datepackage.M2022.May.thirtyOne;

import java.io.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/5/31 9:56
 * @Version 1.0
 */
public class ReadDemo {
    public static void main(String[] args) throws IOException {
        //返回读取指定资源的输入流
//        InputStream is = ReadDemo.class.getResourceAsStream("conf/res.txt");
        File file = new File(".","config.txt");

        System.out.println(file);
        System.out.println(file.getCanonicalFile());



        // 或者 this..getClass().getClassLoader().getResourceAsStream("res.txt");
        // 如果是resource目录下可以直接写文件名称
//        BufferedReader br = new BufferedReader(new InputStreamReader(is));
//        String s = "";
//        while ((s = br.readLine()) != null)
//            System.out.println(s);
    }
}
